Skip to content

test(android-e2e): record rotation state and logcat rotation decisions on a failed step - #2350

Open
thymikee wants to merge 4 commits into
mainfrom
claude/android-e2e-rotation-evidence
Open

test(android-e2e): record rotation state and logcat rotation decisions on a failed step#2350
thymikee wants to merge 4 commits into
mainfrom
claude/android-e2e-rotation-evidence

Conversation

@thymikee

@thymikee thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member

Summary

Diagnostics for the Android Smoke failures on the post-alert canary (get text id="automation-alert-result" since 2026-09-03, wait for Alert result: cancelled on #2344).

The failed-step screenshot and snapshot from https://github.com/callstack/agent-device/actions/runs/34021894996 show the device in landscape at the timeout: Open automation alert is 2220px wide and the alert-result canary sits below the fold, so 16 readable polls never contained it. Every tap before the alert landed at x=540, so the device was portrait through open alert; orientation portrait had been confirmed by the fixture 12s earlier. The same layout explains the earlier Selector did not match failures on that step. Nothing in the artifacts says what rotated it: the emulator's Vulkan surface events happen ~95s after boot in passing runs too, and the guest settings alone never flip a local emulator.

Change

A failed step now also writes failed-step-N-device.txt next to the screenshot and snapshot, through adb rather than agent-device so it stands even when the CLI path is what failed:

  • settings get system accelerometer_rotation and user_rotation (the two values orientation writes)
  • the rotation lines of dumpsys display
  • WindowManager's rotation decisions from logcat -d, with the reason Android logs for each

The shared harness gains an optional deviceEvidence hook; iOS does not implement it yet.

Validation

Probe commands verified against a local emulator (settings, display rotation lines, logcat rotation decisions all return output). Root typecheck, oxlint, oxfmt clean. The evidence itself only appears on a failed CI step, which the Android lane has been producing on roughly half its runs.

…s on a failed step

The Android smoke has failed on the post-alert canary since 2026-09-03,
and the failed-step screenshot from run 34021894996 shows why the reads
miss: the device is in landscape at that point, with the canary below
the fold, although `orientation portrait` had taken effect (the fixture
confirmed it and every tap before the alert landed at x=540). Nothing we
keep says what rotated it. A failed step now also writes
failed-step-N-device.txt with the two rotation settings, the display's
rotation lines, and WindowManager's rotation decisions from logcat, read
through adb so they stand even when the CLI path failed.
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.49 MB 4.49 MB 0 B
Package (unpacked) 4.49 MB 4.49 MB 0 B
Package (download) 1.33 MB 1.33 MB +4 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.5 ms 28.0 ms +0.5 ms
CLI --help 82.2 ms 81.9 ms -0.4 ms

@thymikee

thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

The diagnostics are useful, but 825faf0 needs a small follow-up before merge:

  • Fallow fails on captureFailedStepEvidence. Extract the evidence collectors at the shared harness boundary rather than suppressing the gate.
  • Add a deterministic failed-step test that verifies the device file contents and its path in failed-step.txt, plus a hook-failure case that still collects the screenshot/snapshot. A passing Android smoke run does not exercise this branch.
  • Bound the optional probes as a group. Four sequential 20-second probes currently delay the existing screenshot/snapshot by up to 80 seconds, when the failure state may already have changed. Keep that collection from blocking the existing evidence and cap logcat line lengths as well as line count.

…tation-evidence

* origin/main:
  fix(ios): stop charging every capture for a slow Simulator app discovery (#2331)
  refactor(commands): move commands-side rendering out of src/daemon and retire the doctor progress flag (#2349)
@thymikee

thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

The iOS smoke lane also finished red at the depth-1 bridge assertion, after target-resolution-failed fell back to XCTest. This is outside the Android diagnostics diff; the existing collector/test findings remain, and the required lane still needs to pass.

…e probes, test it

Review follow-up on the rotation evidence. The collectors move out of
the harness closure into failed-step-evidence.ts (fallow complexity),
where the platform hook runs alongside the screenshot and snapshot and
is bounded as a group (15s) so it can never delay them; a hook that
throws, answers nothing, or never answers records nothing for the device
file and leaves the CLI evidence in place. The Android probes get a 5s
per-command bound, and logcat lines are capped in count and length.
Deterministic tests cover the file contents, the hook failure and
timeout cases, and the harness naming every evidence file, device file
included, in failed-step.txt.
@thymikee

thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

Addressed:

  • The collectors live in test/integration/live-device-e2e/failed-step-evidence.ts; the harness only builds the input (stem, bound CLI, optional hook). Fallow is clean on the changed files.
  • test/integration/live-device-e2e-failed-step-evidence.test.ts (node:test, runs with the integration node suite): device facts land in failed-step-N-device.txt with the exact contents next to the screenshot and snapshot; a hook that throws or returns nothing leaves the CLI evidence in place; a hook that never answers is bounded (50ms in the test) and does not delay the CLI evidence; and through createLiveDeviceHarness, a failing step's message and failed-step.txt name all three files.
  • The device hook runs alongside the screenshot and snapshot, not before them, bounded as a group at 15s. Each adb probe is bounded at 5s, logcat lines are capped at 60 and 240 chars, display lines at 8 and 240 chars.

Main merged in for the typecheck break that failed the iOS lane's build step here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant